package com.caisejingyu.whales

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.caisejingyu.whales.common.L
import com.caisejingyu.whales.control.toast.IToastBuilder
import com.caisejingyu.whales.control.toast.ToastUtil
import com.caisejingyu.whales.home.ui.HomeActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        //跳转到请求页
        open_request.setOnClickListener {
            startActivity(Intent(this, RequestActivity::class.java))
        }

        toast_empty_icon.setOnClickListener {
            ToastUtil.show(this, IToastBuilder.ICON_TYPE_NONE, "没有图标")
        }
        toast_ok.setOnClickListener {

            ToastUtil.show(this, IToastBuilder.ICON_TYPE_OK, "成功")
        }
        toast_error.setOnClickListener {
            ToastUtil.show(this, IToastBuilder.ICON_TYPE_ERROR, "失败")
        }

        toast_alert.setOnClickListener {
            ToastUtil.show(this, IToastBuilder.ICON_TYPE_WARN, "警告")
        }

        log_normal.setOnClickListener {
            L.i("AAA", "正常")
        }

        log_info.setOnClickListener {
            L.f().i("AAA", "带信息")
        }
        crashException.setOnClickListener {
            val ints = IntArray(5)
            val number = ints.set(5, 6)
            L.f().i("AAA", "数字${number}")
        }

        openHome.setOnClickListener {
            startActivity(Intent(this, HomeActivity::class.java))
        }
    }


}
